/*
 * Copyright (c) 2019 , Healthlink All Rights Reserved.
 */

package com.mayday.system.domain;

/**
 * 审核状态
 *
 * @author lxq
 * @version 1.0
 * @date 2020 /4/4 18:04
 * @since JDK 1.8+
 */
public enum FlowStateEnum {

    /**
     * 定义病历审核状态
     */
    DNS(1,"未提交审核"),
    COMMIT(2,"审核中"),
    REJECT(3,"已驳回"),
    PASS(4,"审核结束"),
    ARCH(5,"已归档"),
    REVOKE(6,"已撤回");


    private int code;
    private String name;

    FlowStateEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * Sets code.
     *
     * @param code the code
     * @return the code
     */
    public FlowStateEnum setCode(int code) {
        this.code = code;
        return this;
    }

    /**
     * Gets name.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Sets name.
     *
     * @param name the name
     * @return the name
     */
    public FlowStateEnum setName(String name) {
        this.name = name;
        return this;
    }


    public static String getNameByCode(int code) {
        for (FlowStateEnum s : FlowStateEnum.values()) {
            if (code==s.getCode()) {
                return s.getName();
            }
        }
        return "";
    }

}
